package com.platform.dto;

import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * description:区域部门树节点
 *
 * @author qy
 * @version v1.0
 * @date Created in 2020/10/16
 */
@Data
public class DomainTreeNode implements Serializable {
    private String id;

    private String code;

    private String text;

    private String parentId;

    private List<? extends DomainTreeNode> children = new ArrayList<>();

    private DomainTreeData data;
    public DomainTreeNode() {
    }

    public static DomainTreeNode of(String id, String code, String text, String parentId, String departKind , String unifiedCode,
                                    String reginId, String orgType, String remark, Integer sortNum, List<? extends DomainTreeNode> children, String leadId, String leadName) {
        DomainTreeNode node = new DomainTreeNode();
        DomainTreeData domainTreeData = new DomainTreeData();
        domainTreeData.setParentId(parentId);
        domainTreeData.setDepartName(text);
        domainTreeData.setDepartCode(code);
        domainTreeData.setDepartKind(departKind);
        domainTreeData.setUnifiedCode(unifiedCode);
        domainTreeData.setRegionId(reginId);
        domainTreeData.setOrgType(orgType);
        domainTreeData.setRemark(remark);
        domainTreeData.setSortNum(sortNum);
        domainTreeData.setLeadId(leadId);
        domainTreeData.setLeadName(leadName);
        node.setData(domainTreeData);
        node.setId(id);
        node.setCode(code);
        node.setParentId(parentId);
        node.setText(text);
        node.setChildren(children);
        return node;
    }
    public static DomainTreeNode of(String id, String code, String text, String parentId, List<? extends DomainTreeNode> children) {
        DomainTreeNode node = new DomainTreeNode();
        node.setId(id);
        node.setCode(code);
        node.setParentId(parentId);
        node.setText(text);
        node.setChildren(children);
        return node;
    }
}
